﻿using Aurora.AI.Abstractions;
using Aurora.AI.Abstractions.Chats;
using Aurora.AI.Abstractions.Embeddings;
using Aurora.AI.Abstractions.Images;
using Aurora.AI.Hunyuan.Chats;
using Aurora.AI.Hunyuan.Embeddings;
using Aurora.AI.Hunyuan.Images;
using Microsoft.Extensions.DependencyInjection;

namespace Aurora.AI.Hunyuan.Extensions;

public static class HunyuanServiceCollectionExtensions
{
    /// <summary>
    /// 添加腾讯混元平台支持
    /// </summary>
    /// <param name="services"></param>
    /// <returns></returns>
    public static IServiceCollection AddHunyuanService(this IServiceCollection services)
    {
        // 添加平台名和编码对应
        AuroraAIGlobal.PlatformNames.Add(HunyuanPlatformOptions.PlatformName, HunyuanPlatformOptions.PlatformCode);

        // 添加平台支持模型列表
        AuroraAIGlobal.ModelNames.Add(HunyuanPlatformOptions.PlatformCode, [
            "hunyuan-lite",
            "hunyuan-standard",
            "hunyuan-pro",
            "hunyuan-role",
            "hunyuan-code",
            "hunyuan-vision",
            "hunyuan-turbo"
        ]);

        services.AddKeyedSingleton<IAuroraAIChatCompletionsService, HunyuanChatCompletionsService>(HunyuanPlatformOptions.PlatformCode);
        services.AddKeyedSingleton<IAuroraAIImageService, HunyuanImageService>(HunyuanPlatformOptions.PlatformCode);

        services.AddKeyedSingleton<IAuroraAITextEmbeddingService, HunyuanTextEmbeddingService>(HunyuanPlatformOptions
            .PlatformCode);
        return services;
    }
}